#ifndef WIDGETBOXCATEGORYLISTVIEW_H
#define WIDGETBOXCATEGORYLISTVIEW_H

#include "category.h"

#include <QListView>

class WidgetBoxCategoryModel;

class WidgetBoxCategoryListView: public QListView
{
    Q_OBJECT
public:
    explicit WidgetBoxCategoryListView(QWidget *parent = 0);
    void setViewMode(ViewMode vm);

    using QListView::contentsSize;

    int count() const;
    Widget widgetAt(const QModelIndex &index) const;
    Widget widgetAt(int row) const;
    void setCurrentItem(int row);

    void addWidget(const Widget &widget, const QIcon &icon, bool editable);
    bool containsWidget(const QString &name);
    Category category() const;

signals:
    void pressed(const QString &name, const QString &xml, const QPoint &globalPos);
private slots:
    void slotPressed(const QModelIndex &index);
private:
    int mapRowToSource(int filterRow) const;
    WidgetBoxCategoryModel *m_model;
};

#endif // WIDGETBOXCATEGORYLISTVIEW_H
